Home

Operator Usage

Name

-

Description

ket1 - ket2
the infix operator for ket subtraction
If the label of ket1 is the same as the label of ket2, then subtract their coefficients
If the labels are distinct, then we have a superposition
Where a superposition is the sum of one or more kets
Note, the identity element for ket addition is the empty ket |>
Ie, sp + |> == |> + sp == sp, for any superposition sp
Note that combined with the drop operator, subtraction can be seen as a kind of inhibition


Examples

-- taking two apples from five apples:
5|apple> - 2|apple>
    3|apple>

-- taking 5 apples from 7 oranges:
-- we can't subtract them directly, they have different labels, so return a superposition:
7|orange> - 5|apple>
    7|orange> - 5|apple>


See also

drop, + , _ , __ , :_ , .

Operator type

infix type 1